extends Node2D
class_name Point
# 初始化参数
export(String, FILE, "*.png") var switch_on_texture : String
export var switch_off_texture: String
export var point_index:int

#放置点的位置
var _box_index:int

onready var _point_sp = $Sprite

func _ready():
	_update_ic()

func update_point_index(idx):
	_box_index = idx
	_update_ic()
	
#func _process(delta):
#	_update_ic()

func is_target_box():
	return _box_index == point_index 

func _update_ic() :
	if not _point_sp:
		return
	var texture = ImageTexture.new()
	var image = Image.new()
	
	var texture_res = switch_on_texture if is_target_box() else switch_off_texture
	
	image.load(texture_res)
	texture.create_from_image(image)
	_point_sp.texture = texture
